From: Jasper St. Pierre Date: Thu, 17 Nov 2011 04:47:35 +0000 (-0500) Subject: browser-plugin: Make sure to use the UTF8Length parameter X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7262 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ab6a7773ce0bf0b6614fe81acc26521739723853;p=gnome-shell.git browser-plugin: Make sure to use the UTF8Length parameter Some plugin hosts may have junk after the UTF8Characters that we need to strip off. No current browsers that I know of do this, but it still helps to be correct. --- diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c index 385550c34..e9f99502b 100644 --- a/browser-plugin/browser-plugin.c +++ b/browser-plugin/browser-plugin.c @@ -455,7 +455,7 @@ plugin_enable_extension (PluginObject *obj, NPString uuid, gboolean enabled) { - const gchar *uuid_str = uuid.UTF8Characters; + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -468,6 +468,8 @@ plugin_enable_extension (PluginObject *obj, NULL, /* callback */ NULL /* user_data */); + g_free (uuid_str); + return TRUE; } @@ -476,7 +478,7 @@ plugin_install_extension (PluginObject *obj, NPString uuid, NPString version_tag) { - const gchar *uuid_str = uuid.UTF8Characters; + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -491,6 +493,8 @@ plugin_install_extension (PluginObject *obj, NULL, /* callback */ NULL /* user_data */); + g_free (uuid_str); + return TRUE; } @@ -501,9 +505,9 @@ plugin_uninstall_extension (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -516,6 +520,8 @@ plugin_uninstall_extension (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to uninstall extension: %s", error->message); @@ -533,9 +539,9 @@ plugin_get_info (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -547,6 +553,8 @@ plugin_get_info (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to retrieve extension metadata: %s", error->message); @@ -564,9 +572,9 @@ plugin_get_errors (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -578,6 +586,8 @@ plugin_get_errors (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to retrieve errors: %s", error->message);